'''
    读取Excel文件，作为数据来源去进行测试
    读取Excel数据，openpyxl/pandas
'''
import pandas


def pandas_read_excel_dict(filepath,sheetname):
    #读取excel数据，数据来源
    data = pandas.read_excel(filepath, sheet_name=sheetname)
    data = data.where(data.notnull(), '')
    datadict = data.to_dict(orient='records')
    return (datadict)
if __name__ == '__main__':
    filepath = r'D:\20250402开始学习华测教育\Now Test\Appium-Python-Client\AppPom\day12\data\kaoyanbang.xlsx'
    sheetname = 'kaoyanbang'
    print(pandas_read_excel_dict(filepath, sheetname))